<template>
	<page-body>
		<view class="page">
			<view
				class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex inputNewPhone_flex_0_higd"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-stretch justify-between inputNewPhone_fd0_0_higd'>
					<view class='flex flex-wrap align-center inputNewPhone_fd0_0_c0_higd' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  inputNewPhone_fd0_0_c0_c0_higd'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='inputNewPhone_fd0_0_c1_c0_higd'>{{$t('绑定新手机')}}</text>
					</view>
					<view class='flex align-center justify-end inputNewPhone_fd0_0_c2_higd'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---输入新的手机号-表单flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch inputNewPhone_flex_1_higd">
				<view class='flex flex-wrap align-center inputNewPhone_fd1_0_higd'>
					<text class='inputNewPhone_fd1_0_c0_higd'>{{$t('新手机号码')}}</text>
					<benben-input class='flex-sub inputNewPhone_fd1_0_c1_higd' type="number" :focus='true'
						:placeholder="$t('请输入新的手机号')" confirm-type="done" :maxlength="11"
						placeholder-style="color:#999;font-size:32rpx" v-model="mobile" />
				</view>
				<view class='flex flex-wrap align-center inputNewPhone_fd1_0_higd'>
					<text class='inputNewPhone_fd1_0_c0_higd'>{{$t('短信验证')}}</text>
					<benben-input class='flex-sub inputNewPhone_fd1_1_c1_higd' type="number" :placeholder="$t('请输入验证码')"
						confirm-type="done" :maxlength="6" placeholder-style="color:#999;font-size:32rpx"
						v-model="code" />
					<benben-send-verification-code key='1687690525918' ref="vCode1687690525918"
						class=' inputNewPhone_fd1_1_c2_higd' :after-text="$t('后重新获取')" :before-text="$t('获取短信验证')"
						type='5' :is-environment-verification='true' :phone="mobile"></benben-send-verification-code>
				</view>
				<button class='flex-sub inputNewPhone_fd1_2_higd' @tap.stop="checkCodeFunc()">{{$t('完成')}}</button>
			</view>

			<!---输入新的手机号-表单flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	import { host } from '@/common/config.js';

	export default {
		components: {},


		data() {
			return {
				"mobile": "",
				"code": ""
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//校验
			async checkCodeFunc() {
				if (!validate(this.mobile, 'require')) {
					this.$message.info(global.i18n.t('请输入手机号'));
					return false;
				}
				if (!validate(this.mobile, 'phone')) {
					this.$message.info(global.i18n.t('请输入正确的手机号'));
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info(global.i18n.t('请输入验证码'));
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info(global.i18n.t('请输入正确的验证码'));
					return false;
				}
				//请求方法
				//数据验证
				let url=global.apiUrls.post5f6c915d69d1f
				// 教师
				if(uni.getStorageSync('USER_GROUP') ==2){
					url=host+'/api/v1/5f6c915d69d1f'
					console.log(global.istest)
					global.istest=0
				}
				console.log(this.qrPwd)
				let data5f6c915d69d1f = await this.$api.post(url, {
					mobile: this.mobile,
					account: this.mobile,
					code: this.code,
					type: '5'
				});

				if (data5f6c915d69d1f.data.code != 1) {
					this.$message.info(data5f6c915d69d1f.data.msg);
					return
				}
				let info5f6c915d69d1f = data5f6c915d69d1f.data;


				this.$store.commit('logout')
				setTimeout(() => {
					this.$urouter.reLaunch(`/pagetabBar/loginPage/loginPage`);
				}, 500)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto;

		.inputNewPhone_flex_1_higd {
			font-size: 32rpx;
			background: #fff;
			background-size: 100% auto !important;
			padding: 0rpx 32rpx 0rpx 32rpx;

			.inputNewPhone_fd1_2_higd {
				border-radius: 44rpx 44rpx 44rpx 44rpx;
				font-size: 32rpx;
				background: rgba(211, 42, 41, 1);
				color: #fff;
				margin: 300rpx 32rpx 0rpx 32rpx;
				height: 88rpx;
				line-height: 88rpx;
				width: 638rpx;
			}
		}

		.inputNewPhone_fd1_0_higd {
			padding: 32rpx 0rpx 32rpx 0rpx;
			border-bottom: 1px solid #eee;

			.inputNewPhone_fd1_0_c1_higd {
				line-height: 45rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: var(--benbenFontColor0);
			}
		}

		.inputNewPhone_fd1_0_c0_higd {
			font-size: 32rpx;
			font-weight: 400;
			font-style: normal;
			color: var(--benbenFontColor0);
			width: 182rpx;
		}

		.inputNewPhone_fd1_1_c1_higd {
			line-height: 45rpx;
			color: var(--benbenFontColor0);
			font-size: 32rpx;
			font-weight: 400;
		}

		.inputNewPhone_fd1_1_c2_higd {
			font-size: 28rpx;
			font-weight: 400;
			color: var(--benbenFontColor4);
		}

		.inputNewPhone_flex_0_higd {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;
			border-bottom: 1px solid #eee;

			.inputNewPhone_fd0_0_higd {
				padding: 0rpx 32rpx 0rpx 32rpx;
				line-height: 88rpx;

				.inputNewPhone_fd0_0_c0_higd {
					width: 100rpx;

					.inputNewPhone_fd0_0_c0_c0_higd {
						font-size: 36rpx;
						font-weight: 400;
						color: #333;
					}
				}

				.inputNewPhone_fd0_0_c1_c0_higd {
					font-size: 36rpx;
					font-weight: 500;
					color: var(--benbenFontColor0);
					line-height: 50rpx;
				}

				.inputNewPhone_fd0_0_c2_higd {
					padding: 0rpx 0rpx 0rpx 0rpx;
					width: 100rpx;
				}
			}
		}
	}
</style>
